#!/usr/bin/python3
# -*- coding:utf-8 -*-
""""
   @Author: 即将拥有人鱼线的yjw
   @Time: 2024/8/5 14:54
   @File: check_files.py
   @desc:
"""
import os


def compare_folders(folder1, folder2):
    """比较两个文件夹中的文件是否相同"""
    # 获取每个文件夹中的文件列表
    files1 = set(os.listdir(folder1))
    files2 = set(os.listdir(folder2))
    # print(files2)

    # 检查文件夹是否包含相同的文件名
    common_files = files1.intersection(files2)
    # 比较文件内容
    #folder1
    different_files1 = files1.symmetric_difference(common_files)
    different_files2 = files2.symmetric_difference(common_files)
    print(f"folder1中不同的元素为：{different_files1}")
    print(f"folder1中不同的元素个数为：{len(different_files1)}")
    print(f"folder2中不同的元素为：{different_files2}")
    print(f"folder2中不同的元素个数为：{len(different_files2)}")





if __name__ == '__main__':

    # 示例使用
    folder_a = r'C:\Users\yejw46507\Downloads\RCMP5.0-CommonScripts-dependencies-V202401-6-0\hsrcm-CommonScripts-dependencies\libs'
    folder_b = r'C:\Users\yejw46507\Downloads\RCMP5.0-CommonScripts-dependencies-V202401-5-4\hsrcm-CommonScripts-dependencies\libs'

    mismatched_files = compare_folders(folder_a, folder_b)

